#include "gamepadvalue.h"

GamepadValue::GamepadValue(QObject *parent) : QObject(parent)
{
    leftX = 0;
    leftY = 0;  //左摇杆
    rightX = 0;
    rightY = 0; //右摇杆

    left1 = 0;  //左肩键
    left2 = 0;  //左扳机
    right1 = 0; //右肩键
    right2 = 0; //右扳机

}

void GamepadValue::SetDoubleValue(int Chanel, double value)
{
    switch (Chanel) {
    case 0:
        leftX = value;
        break;
    case 1:
        leftY = value;
        break;
    case 2:
        rightX = value;
        break;
    case 3:
        rightY = value;
        break;
    case 4:
        left2 = value;
        break;
    case 5:
        right2 = value;
        break;
    }

}

void GamepadValue::SetBoolValue(int Chanel, bool value)
{
    switch (Chanel) {
    case 0:
        left0 = value;
        break;
    case 1:
        right0 = value;
        break;
    case 2:
        left1 = value;
        break;
    case 3:
        right1 = value;
        break;
    case 4:
        up = value;
        break;
    case 5:
        down = value;
        break;
    case 6:
        left = value;
        break;
    case 7:
        right = value;
        break;
    case 8:
        X = value;
        break;
    case 9:
        Y = value;
        break;
    case 10:
        A = value;
        break;
    case 11:
        B = value;
        break;
    case 12:
        guide = value;
        break;
    case 13:
        select = value;
        break;
    case 14:
        start = value;
        break;

    }
}
